<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <!-- 
    按键修饰符
Vue 为一些常用的按键提供了别名:
.enter
.tab
.delete (捕获“Delete"和“Backspace”两个按键)
.esc
.space
.up
.down
.left
.right


也可以组合使用：
@keyup.enter.ctrl  按ctrl+回车
@keyup.a   输入a触发事件. 以前必须keycode===65 



   -->
    <div id="app">
        <input type="text" v-model="mytext" @keyup.enter="handlekeyup">
        <button @click="handleAdd">add</button>
    </div>



    <script>
        var obj = {
            data() {
                return {
                    mytext: ''
                }
            },
            methods: {
                handlekeyup() {

                    console.log(this.mytext);
                },
                handleAdd() {
                    console.log('add');
                }
            }
        }

        Vue.createApp(obj).mount('#app')
    </script>
</body>

</html>